package com.kun.music.service.impl;

import com.kun.music.dao.ConsumerMapper;
import com.kun.music.domain.Consumer;
import com.kun.music.service.ConsumerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author fangkun
 * @create 2022-12-21-15:20
 */
@Service
public class ConsumerServiceImpl implements ConsumerService {

    @Autowired
    private ConsumerMapper consumerMapper;

    @Override
    public List<Consumer> allUser() {
        return consumerMapper.allUser();
    }

    @Override
    public boolean addUser(Consumer consumer) {
        return consumerMapper.addUser(consumer)>0 ? true : false;
    }

    @Override
    public boolean deleteUser(Integer id) {
        return consumerMapper.deleteUser(id)>0 ? true : false;
    }

    @Override
    public boolean updateUser(Consumer consumer) {
        return consumerMapper.updateUser(consumer)>0 ? true : false;
    }

    @Override
    public boolean updateUserPic(Consumer consumer) {
        return consumerMapper.updateUserPic(consumer)>0 ? true : false;
    }

    @Override
    public List<Consumer> getUserById(int id) {
        return consumerMapper.getUserById(id);
    }

    @Override
    public boolean login(String username, String password) {

        return consumerMapper.login(username,password)>0 ? true : false;
    }

    @Override
    public List<Consumer> loginStatus(String username) {
        return consumerMapper.loginStatus(username);
    }
}
